const Queue = require('./00-封装队列')

function getOne(players, num) {
  let q = new Queue()
  q.enqueue(players)
  while (q.size() > 1) {
    for (let i = 0; i < num - 1; i++) {
      q.enqueue(q.dequeue())
    }
    q.dequeue()
  }
  return q.items[0]
}
console.log(getOne([5, 4, 3, 2, 1], 3));